package cn.zhl.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-04-20 11:22
 **/
public class LambdaTest {
	public static void main(String[] args) {
		List<String> names = Arrays.asList("b", "r", "y", "w", "a");
		System.out.println(names);
//        Collections.sort(names, new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                return o2.compareTo(o1);
//            }
//        });
//        Collections.sort(names,(String a,String b)->{
//            return b.compareTo(a);
//        });
//        Collections.sort(names,(String a,String b)->{return b.compareTo(a);});
		Collections.sort(names, (String a, String b) -> b.compareTo(a));
//        Collections.sort(names, Comparator.reverseOrder());

		System.out.println(names);
	}
}
